﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class LeaveMsg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		SE6.User curUsr = SessionMan.GetLoginUser();
		String title = (String)Request.Form["title"];
		Boolean canLW = SystemMan.IsFunctionEnabled(FounctionType.LeaveWord);
		if (canLW)
		{
			if (title != null && title != "")
			{
				//新增主题帖
				if (curUsr != null || SessionMan.ValidateCheckCode((String)Request.Form["checkCode"]))
					feedBack.Text = BBS.AddTopic(Request);
				else
					feedBack.Text = "请输入正确验证码！！！";
			}
			else if (curUsr == null)
				feedBack.Text =
					"提示：注册用户发表留言不用输入验证码哦，赶快<a href='Login.aspx' >登录</a>或<a href='Register.aspx' >注册</a>一个吧";
		}
		else
		{
			feedBack.CssClass = "cue";
			feedBack.Text = "系统正在维护中，留言吧暂时只能浏览帖子";
		}
		form1.Disabled = !canLW;
		if (!canLW)
			form1.InnerHtml = "";
		topics.InnerHtml=BBS.ViewTopic(Request);
		if (curUsr==null)
		{
			//需要验证码
			checkCode.Text = "<tr><td>验证码:</td><td><input type='text' name='checkCode' id='checkCode' size='4' onfocus='return RefreshCheckCode();'/>请输入右图中四位验证码，<img id='ccImg' src='CheckCodeImg.aspx'  alt = '验证码' /><a href='#' onclick='return RefreshCheckCode();'>看不清？换！</a></td></tr>";
		}
		navMenu.InnerHtml = GUI.NavMenu(PageClass.LeaveMessage);
    }
}
